package git.luohao.controller;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;
import java.util.Enumeration;

@RestController
@RequestMapping("/order")
public class OrderController {

    @RequestMapping("/getOrder/{id}")
    public String getOrder(HttpServletRequest request, @PathVariable("id") String id) {
        System.out.println(id);
        final Enumeration<String> headerNames = request.getHeaderNames();
        while (headerNames.hasMoreElements()) {
            final String headname = headerNames.nextElement();
            System.out.println(headname + "=" + request.getHeader(headname));
        }
        return id;
    }

    @RequestMapping("/getOrder2/{id}")
    public String getOrder2(@RequestHeader("X-Request-color") String color, @PathVariable("id") String id, @RequestParam("") String aa) {
        System.out.println(id);
        System.out.println(color);
        return id;
    }
}
